home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
cug106
/
system.c
< prev
next >
Wrap
Text File
|
1984-06-14
|
3KB
|
139 lines
/* system definitions
**
** Version 1.2 07-Aug-80
*/
#define ASCII_DATE 0x20BF /* ASCII date */
#define CODED_DATE ASCII_DATE+9 /* coded date */
#define TICCNT 0x201B /* 2ms counter */
#define UIVEC 0x201F /* user vector */
/* BDOS addresses */
#define CBOOT 0x1800
#define BIOS 0x2280
#define BASE 0x4200
#define WBOOT BASE
#define IOBYT BASE+3
#define BDOS BASE+5
#define MEM_SIZE BASE+6
#define FCB BASE+92
#define FCBDN FCB+0 /* disk name */
#define FCBFN FCB+1 /* file name */
#define FCBFT FCB+9 /* file type */
#define FCBRL FCB+12 /* reel number */
#define FCBST FCB+13 /* status (date,flags) */
#define FCBRC FCB+15 /* record count */
#define FCBCR FCB+32 /* next record number */
#define FCBLN FCB+33 /* FCB length */
#define BUFF BASE+128
#define TPA BASE+0x100
/* BDOS system calls */
#define SYS_RESET 0
#define RD_CON 1
#define WR_CON 2
#define RD_RDR 3
#define WR_PUN 4
#define WR_LST 5
#define INTER_IO 7
#define ALTER_IO 8
#define WR_BUFFER 9
#define RD_BUFFER 10
#define CHECK_STATUS 11
#define RESET_DISK 13
#define SELECT_DISK 14
#define OPEN_FILE 15
#define CLOSE_FILE 16
#define SEARCH_FIRST 17
#define SEARCH_NEXT 18
#define DELETE_FILE 19
#define RD_RECORD 20
#define WR_RECORD 21
#define CREATE_FILE 22
#define RENAME_FILE 23
#define INTER_LOGIN 24
#define INTER_DISK 25
#define SET_DMA 26
#define INTER_ALLOC 27
/*
Function Summary
----------------
charcnt(bufpntr)
returns the number of characters in the file at bufpntr.
file must be in a continuous block of RAM.
linecnt(bufpntr)
returns the number of lines in the file at bufpntr.
file must be in a continuous block of RAM.
ntoi(number,base)
converts ASCII digits to an integer using any base
except split octal (see otoi). white space may preceed
the ASCII string which must end with '\0' after the
final digit.
otoi(number)
converts ASCII digits representing a split octal
number in the format xxx.xxx{a} to an integer. white
space may preceed the ASCII string which must be
7 characters long (3 chars,'.',3 chars). any following
characters are ignored (ie. does not require '\0' as
final delimiter).
wordcnt(bufpntr)
returns the number of words in the file at bufpntr.
file must be in a continuous block of RAM. note that
'\n' is handled explicitly as CRLF to avoid false
triggering of the word count on an empty line.
*/
#define LF 10
#define CR 13
#define EOF 26
#define NO 0
#define YES -1
charcnt(bufpntr)
char *bufpntr;
{
int nc;
char c;
nc = 0;
while((c = *bufpntr++) != EOF) nc += 1;
return nc;
}
linecnt(bufpntr)
char *bufpntr;
{
int nc;
char c;
nc = 0;
while((c = *bufpntr++) != EOF) {
if (c == '\n') nc += 1;
}
return nc;
}
ntoi(n,b)
char *n;
int b;
{
int val,sign;
char c;
val=0; sign=1;
while ((c = *n) == '\t' || c == ' ') ++n;
if (c == '-')